package net.tngou.action;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import javax.servlet.ServletException;

import net.tngou.jdbc.OrderType;
import net.tngou.jdbc.QueryHelper;
import net.tngou.pojo.Item;
import net.tngou.pojo.POJO;
import net.tngou.util.DigestMD;


public class ItemsAction extends BaseAction {

	@Override
	public void execute() throws ServletException, IOException {
		
		 List<String> tags = new ArrayList<String>();
		 tags.add("见义勇为");
		 tags.add("诚实守信");
		 tags.add("敬业奉献");
		 tags.add("孝老爱亲");
		 tags.add("助人为乐");
		 root.put("tags",  tags);
		 List<Item> items = (List<Item>) service.getList("id",OrderType.ASC,Item.class);
		
		 root.put("items", items);
		 root.put("title", "第五届最美“十大金牛好人” 投票结果");    
		 root.put("keywords", "最美“十大金牛好人” ");
		 root.put("description","第五届最美“十大金牛好人” 评选活动");
		 int max=maxCount()+100;
		 if(max<5000)max=5000;
		 if(max>100000)max=100000;
		 root.put("max", max);
		 printFreemarker("default/items.ftl", root);
		 
		 
		 
	}
	
	public int maxCount() {
		return (int) QueryHelper.stat("SELECT max(vcount) FROM  item" );
	}
}
